import { loginHttp } from '@/utils/axios'
import type { LoginDto, LoginResponseDto, ApiResult } from '@/types/auth'

export const login = async (loginData: LoginDto): Promise<ApiResult<LoginResponseDto>> => {
  try {
    const response = await loginHttp.post('/ConsoleApi/login', loginData)
    return response.data
  } catch (error: any) {
    console.error('API错误:', error)
    return {
      msg: '登录失败，请重试',
      code: 500,
      data: {} as LoginResponseDto
    }
  }
}

export default loginHttp 